package demo;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.io.IOException;
import java.util.Arrays;

/**
 * Created by Ethan on 2018/5/14.
 *
 * @author Ethan dlsscly@foxmail.com
 */
public class demoClass {

    @Test
    public void test(){
        Assert.assertTrue(false);
        System.out.println("testCase");
    }

    @Test
    public void testGetHttpRequest() throws IOException {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        HttpGet httpGet = new HttpGet("http://www.baidu.com");
        CloseableHttpResponse response = httpClient.execute(httpGet);
        //检查响应码 正常这里是200
        Assert.assertEquals(response.getStatusLine().getStatusCode(),200);
    }

}
